home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / mus / misc / maplay1_2.lha / maplay / subband_layer_2.h < prev    next >
C/C++ Source or Header  |  1994-06-23  |  3KB  |  110 lines

  1. /*
  2.  *  @(#) subband_layer_2.h 1.8, last edit: 6/15/94 16:51:59
  3.  *  @(#) Copyright (C) 1993, 1994 Tobias Bading (bading@cs.tu-berlin.de)
  4.  *  @(#) Berlin University of Technology
  5.  *
  6.  *  This program is free software; you can redistribute it and/or modify
  7.  *  it under the terms of the GNU General Public License as published by
  8.  *  the Free Software Foundation; either version 2 of the License, or
  9.  *  (at your option) any later version.
  10.  *
  11.  *  This program is distributed in the hope that it will be useful,
  12.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  *  GNU General Public License for more details.
  15.  *
  16.  *  You should have received a copy of the GNU General Public License
  17.  *  along with this program; if not, write to the Free Software
  18.  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  */
  20.  
  21. #ifndef SUBBAND_LAYER_2_H
  22. #define SUBBAND_LAYER_2_H
  23.  
  24. #include <stdio.h>
  25. #include "all.h"
  26. #include "subband.h"
  27. #include "header.h"
  28. #include "crc.h"
  29.  
  30.  
  31. // class for layer II subbands in single channel mode:
  32. class SubbandLayer2 : public Subband
  33. {
  34. protected:
  35.   uint32 subbandnumber;
  36.  
  37.   uint32 allocation;
  38.   uint32 scfsi;
  39.   real     scalefactor1, scalefactor2, scalefactor3;
  40.   uint32 codelength;
  41.   const real *groupingtable;
  42.   real     factor;
  43.  
  44.   uint32 groupnumber;
  45.   uint32 samplenumber;
  46.   real     samples[3];
  47.   real     c, d;
  48.  
  49.   uint32 get_allocationlength (Header *);
  50.   void     prepare_sample_reading (Header *, uint32, const real **, real *,
  51.                  uint32 *, real *, real *);
  52.  
  53. public:
  54.         SubbandLayer2 (uint32 subbandnumber);
  55.   void        read_allocation (Ibitstream *, Header *, Crc16 *);
  56.   virtual void    read_scalefactor_selection (Ibitstream *, Crc16 *);
  57.   void        read_scalefactor (Ibitstream *, Header *);
  58.   bool        read_sampledata (Ibitstream *);
  59.   bool        put_next_sample (e_channels, SynthesisFilter *, SynthesisFilter * = NULL);
  60. };
  61.  
  62.  
  63. // class for layer II subbands in joint stereo mode:
  64. class SubbandLayer2IntensityStereo : public SubbandLayer2
  65. {
  66. protected:
  67.   uint32 channel2_scfsi;
  68.   real     channel2_scalefactor1, channel2_scalefactor2, channel2_scalefactor3;
  69.  
  70. public:
  71.        SubbandLayer2IntensityStereo (uint32 subbandnumber);
  72.   void read_allocation (Ibitstream *stream, Header *header, Crc16 *crc)
  73.   {
  74.     SubbandLayer2::read_allocation (stream, header, crc);
  75.   }
  76.   void read_scalefactor_selection (Ibitstream *, Crc16 *);
  77.   void read_scalefactor (Ibitstream *, Header *);
  78.   bool read_sampledata (Ibitstream *stream)
  79.   {
  80.     return SubbandLayer2::read_sampledata (stream);
  81.   }
  82.   bool put_next_sample (e_channels, SynthesisFilter *, SynthesisFilter *);
  83. };
  84.  
  85.  
  86. // class for layer II subbands in stereo mode:
  87. class SubbandLayer2Stereo : public SubbandLayer2
  88. {
  89. protected:
  90.   uint32 channel2_allocation;
  91.   uint32 channel2_scfsi;
  92.   real     channel2_scalefactor1, channel2_scalefactor2, channel2_scalefactor3;
  93.   bool     channel2_grouping;
  94.   uint32 channel2_codelength;
  95.   const real *channel2_groupingtable;
  96.   real     channel2_factor;
  97.   real     channel2_samples[3];
  98.   real     channel2_c, channel2_d;
  99.  
  100. public:
  101.        SubbandLayer2Stereo (uint32 subbandnumber);
  102.   void read_allocation (Ibitstream *, Header *, Crc16 *);
  103.   void read_scalefactor_selection (Ibitstream *, Crc16 *);
  104.   void read_scalefactor (Ibitstream *, Header *);
  105.   bool read_sampledata (Ibitstream *);
  106.   bool put_next_sample (e_channels, SynthesisFilter *, SynthesisFilter *);
  107. };
  108.  
  109. #endif
  110.